﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using WadViewer.DomainModel;

namespace WadViewer.WinApp
{
	public class WadDataTemplateSelector : DataTemplateSelector
	{
		public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
		{
			Application app = Application.Current;

			if (app != null)
			{
				if (item == null)
				{
					return app.FindResource("NothingTemplate") as DataTemplate;
				}
				else if (item is WadTraceLogEntity)
				{
					return app.FindResource("TraceLogTemplate") as DataTemplate;
				}
				else if (item is WadEventLogEntity)
				{
					return app.FindResource("EventLogTemplate") as DataTemplate;
				}
				else if (item is WadPerfCounterEntity)
				{
					return app.FindResource("PerfCounterTemplate") as DataTemplate;
				}
			}
			return null;
		}
	}
}
